import React, { Component } from 'react';

class App extends Component {
  constructor(props){
    super(props);
    this.targetRef = React.createRef();
  }
  componentDidMount (){
    this.targetRef.current.focus();
  }
  render() {
    return (
      <div>
        <input type="text"/>
        <input type="text" ref ={this.targetRef}/>
      </div>
    );
  }
}

export default App;
